﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision.LinearSystem
{
	//public class IterativeSolverRunner<TData, TIterativeMethod, TErrorEvaluator> : ILinearSystemSolver
	//    where TIterativeMethod : IIterativeMethod<TData>, new()
	//    where TErrorEvaluator : IIterativeErrorEvaluator<TData>, new()
	//{
	//    public IterativeSolverRunner()
	//    {
	//        this.IterationCount = 0;
	//        this.IterativeMethod = new TIterativeMethod();
	//        this.ErrorEvaluator = new TErrorEvaluator();
	//        this.MaximumIterationCount = 5000;
	//    }
	//    public TIterativeMethod IterativeMethod { get; set; }
	//    public TData CurrentError { get; private set; }
	//    public TErrorEvaluator ErrorEvaluator { get; set; }

	//    public uint MaximumIterationCount { get; set; }

	//    public uint IterationCount { get; set; }

	//    #region ILinearSystemSolver Members

	//    public void SolveFor<Ty>(IMultiDimensionalArray<Ty> input, IMultiDimensionalArray<TData> load, IMultiDimensionalArray<TData> result)
	//    {
	//        MultiDimensionalArray<TData> L1 = new MultiDimensionalArray<TData>(), L2 = new MultiDimensionalArray<TData>();
	//        L1.Initiate(input.GetLength(1), 1);
	//        L2.Initiate(input.GetLength(1), 1);
	//        do
	//        {
	//            IterativeMethod.NextResult(input, load, L1, ref L2);
	//            MultiDimensionalArray<TData> L3 = L1;
	//            L1 = L2;
	//            L2 = L3;
	//            IterationCount++;
	//        }
	//        while (!ErrorEvaluator.IsErrorSatifactory(ErrorEvaluator.EvaluateError(L1, L2)) && IterationCount < MaximumIterationCount);
	//        for (int i = 0; i < L1.GetLength(1); i++)
	//        {
	//            result[i, 0] = L1[i, 0];
	//        }
	//        return;
	//    }

	//    #endregion
	//}
}
